<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <link rel="stylesheet" href="./index.css">
    <script src="./vue.js"></script>
</head>

<body>
    <div id="app">

        <div class="chat" v-show="index==0">
            <header>聊天</header>
            <ul>
                <li v-for="c in chats">
                    <img :src="c.imgurl" alt="">
                    <strong>{{c.name}}</strong>
                </li>
            </ul>
        </div>


        <div class="friends" v-show="index==1">
           <header> 好友</header>
           <ul>
               <li v-for="(f,index) in friends">
                    <!-- 1 -->
                <!--<h2 @click="temp=!isShowArray[index]; isShowArray.splice(index,1,temp);" >{{f.title}}</h2>-->
                    <!-- 2 -->
             <h2 @click="showOrNot(index)" >{{f.title}}</h2>
                <ul v-show="isShowArray[index]">
                    <li v-for="l in f.list">
                        {{l}}
                    </li>
                </ul>
               </li>
           </ul>

        </div>


        <div class="setting" v-show="index==2">
           <header> 设置</header>
        </div>

        <footer>
            <!--支持三目运算符的操作-->
            <span @click="index=0" :class="index==0?'active':''">聊天</span>
            <span @click="index=1" :class="index==1?'active':''">好友</span>
            <span @click="index=2" :class="index==2?'active':''">设置</span>
        </footer>

    </div>
    <script src="./index.js"></script>
</body>

</html>